<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习三：求一个数字的数字中所有数字的和和平均数</title>
  </head>

  <body>

  </body>
  <script>
    var arr = [10, 30, 25, 6, 8];
    var sum = 0;
    for (var i = 0; i < arr.length; i++) {
      // debugger
      sum += arr[i];
    }
    var averageNum = sum / arr.length;
    console.log(averageNum); //15.8
  </script>

</html>